/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.handlers.commands.call.animation;

/**
 * This class represents a 3 dimensional vector. It stores the x, y and z values. It's used by
 * XREAnimationCallCommandHandler to calculate scale, rotation and translation.
 * <p>
 * <b>Thread Safety:</b> This class is mutable and not thread-safe, it must be used in a thread-safe manner.
 *
 * @author semi_sleep, 7realm
 * @version 1.0
 */
public class Vector3d {
    /**
     * The x value for a 3 dimensional vector.
     * <p>
     * It can be any value. It's set in constructor, it can be modified by a public setter. It has a public getter to
     * expose it to external codes.
     */
    private float x;
    /**
     * The y value for a 3 dimensional vector.
     * <p>
     * It can be any value. It's set in constructor, it can be modified by a public setter. It has a public getter to
     * expose it to external codes.
     */
    private float y;
    /**
     * The z value for a 3 dimensional vector.
     * <p>
     * It can be any value. It's set in constructor, it can be modified by a public setter. It has a public getter to
     * expose it to external codes.
     */
    private float z;

    /**
     * Creates an instance of {@link Vector3d} using x, y and z values.
     *
     * @param x the x value for 3 dimensional vector
     * @param y the y value for 3 dimensional vector
     * @param z the z value for 3 dimensional vector
     */
    public Vector3d(float x, float y, float z) {
        this.x = x;
        this.y = y;
        this.z = z;
    }

    /**
     * Gets the x value for a 3 dimensional vector.
     *
     * @return the x value for a 3 dimensional vector
     */
    public float getX() {
        return x;
    }

    /**
     * Gets the y value for a 3 dimensional vector.
     *
     * @return the y value for a 3 dimensional vector
     */
    public float getY() {
        return y;
    }

    /**
     * Gets the z value for a 3 dimensional vector.
     *
     * @return the z value for a 3 dimensional vector
     */
    public float getZ() {
        return z;
    }

    /**
     * Sets the x value for a 3 dimensional vector.
     *
     * @param x the x value for a 3 dimensional vector
     */
    public void setX(float x) {
        this.x = x;
    }

    /**
     * Sets the y value for a 3 dimensional vector.
     *
     * @param y the y value for a 3 dimensional vector
     */
    public void setY(float y) {
        this.y = y;
    }

    /**
     * Sets the z value for a 3 dimensional vector.
     *
     * @param z the z value for a 3 dimensional vector
     */
    public void setZ(float z) {
        this.z = z;
    }

    /**
     * Returns string representation of the object.
     *
     * @return string representation
     */
    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("[x: ");
        builder.append(x);
        builder.append(", y: ");
        builder.append(y);
        builder.append(", z: ");
        builder.append(z);
        builder.append("]");
        return builder.toString();
    }
}